﻿using Q.Spider.Core.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Q.Spider.Core
{
    public abstract class FlowBase
    {
        /// <summary>
        /// 核心实例
        /// </summary>
        protected QSpiderCore Core { get; set; }

        protected Request Request { get; set; }

        protected Config Config { get; set; }

        protected Engine Engine { get; set; }

        protected FlowContext Context { get; set; }

        /// <summary>
        /// 根据上下文来初始化
        /// </summary>
        public void Init(FlowContext context)
        {
            Core = context.Core;
            Engine = context.Engine;
            Config = context.Config;
            Request = context.Request;
            Context = context;
        }


        public abstract Task RunAsync(FlowContext Context);
    }
}
